#include "BackgroundImage.h"

BackgroundImage::BackgroundImage()
{
	_circle._a = 0;
	_circle._x = 100;
	_circle._y = 100;

	_timer.SetTime(10);
	_timer.Start();
}

void BackgroundImage::Draw(HDC hdc)
{
	HPEN hpenRed = CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
	HPEN hpen = (HPEN)SelectObject(hdc, hpenRed);

	Ellipse(hdc, 50, 50, 300, 300);
	Ellipse(hdc, 60, 60, 290, 290);
	
	Coordinate center;
	center._x = 200;
	center._y = 200;
	center._a = _circle._a;

	Coordinate temp = rotate(_circle, center);

	Ellipse(hdc,
		(int)temp._x, (int)temp._y,
		(int)temp._x + 50, (int)temp._y + 50);

	if (_timer.IsTimeOut())
	{
		++_circle._a;
		if (_circle._a > 360) _circle._a = 0;
	}

	SelectObject(hdc, hpen);
	DeleteObject(hpenRed);
}
